- content_for :page_title, problem.message
- content_for :title_css_class, "err_show #{'resolved' if problem.resolved?}"
- content_for :title, problem.error_class || truncate(problem.message, :length => 32)
- content_for :meta do
  %strong App:
  = link_to app.name, app
  %strong Where:
  = problem.where
  %br
  %strong Environment:
  = problem.environment
  %strong Last Notice:
  = problem.last_notice_at.to_s(:precise)
- content_for :action_bar do
  - if problem.unresolved?
    %span= link_to 'resolve', [:resolve, app, problem], :method => :put,
      :data => { :confirm => problem_confirm('resolve_one') }, :class => 'resolve'
  - if current_user.authentication_token
    %span= link_to 'iCal', polymorphic_path([app, problem], :format => "ics",
      :auth_token => current_user.authentication_token), :class => "calendar_link"
  %span>= link_to 'up', (request.env['HTTP_REFERER'] ? :back : app_problems_path(app)), :class => 'up'
  %br
  = render "issue_tracker_links"

- content_for :comments do
  %h3 Comments
  - problem.comments.each do |comment|
    .window
      %table.comment
        %tr
          %th
            - if comment.user
              - if Errbit::Config.use_gravatar
                = gravatar_tag comment.user.email, :s => 24
              %span.comment-info
                = time_ago_in_words(comment.created_at, include_seconds: true) << " ago by "
                = link_to comment.user.email, comment.user
            - else
              %span.comment-info
                = time_ago_in_words(comment.created_at, true) << " ago by [Unknown User]"
            %span.delete= link_to '&#10008;'.html_safe, [app, problem, comment], :method => :delete,
              :data => { :confirm => t("comments.confirm_delete") }, :class => "destroy-comment"
        %tr
          %td= simple_format comment.body
  = form_for [app, problem, @comment] do |comment_form|
    %p Add a comment
    = comment_form.text_area :body
    = comment_form.submit "Save Comment"

%h4= @notice.try(:message)

= paginate @notices, :param_name => :notice, :theme => :notices

.tab-bar
  %ul
    %li= link_to 'Summary', '#summary', :rel => 'summary', :class => 'button'
    %li= link_to 'Backtrace', '#backtrace', :rel => 'backtrace', :class => 'button'
    - if @notice && @notice.user_attributes.present?
      %li= link_to 'User', '#user_attributes', :rel => 'user_attributes', :class => 'button'
    %li= link_to 'Environment', '#environment', :rel => 'environment', :class => 'button'
    %li= link_to 'Parameters', '#params', :rel => 'params', :class => 'button'
    %li= link_to 'Session', '#session', :rel => 'session', :class => 'button'

- if @notice
  #summary
    %h3 Summary
    = render 'notices/summary', :notice => @notice

  #backtrace
    %h3 Backtrace
    = render 'notices/backtrace', :lines => @notice.backtrace_lines

  - if @notice.user_attributes.present?
    #user_attributes
      %h3 User
      = render 'notices/user_attributes', :user => @notice.user_attributes

  #environment
    %h3 Environment
    = render 'notices/environment', :notice => @notice

  #params
    %h3 Parameters
    = render 'notices/params', :notice => @notice

  #session
    %h3 Session
    = render 'notices/session', :notice => @notice
